package com.robot.mvvm.ui.work.adapter

import com.blankj.utilcode.util.ColorUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.model.QuestionLogDTOBean
import com.robot.mvvm.R

class RepairWorkOrderScheduleAdapter :
    BaseQuickAdapter<QuestionLogDTOBean, BaseViewHolder>(R.layout.app_item_work_order_detail_schedule) {
    override fun convert(holder: BaseViewHolder, item: QuestionLogDTOBean) {
        holder.setGone(R.id.view_top, holder.adapterPosition == 0)
            .setGone(R.id.view_bottom, holder.adapterPosition == data.size - 1)
            .setText(R.id.item_tv_operateType, item.operateTypeText)
            .setText(R.id.item_tv_time, item.createTime)
            .setText(R.id.item_tv_hint, item.information)

        when (item.operateType) {
            //Report-上报，Reject-驳回，Dispatch-派单，Return-退回，OrderTaking-接单，Finish-完成
            "Report" -> {
                holder.setImageResource(R.id.view_cir, R.drawable.app_cir_3ddcff)
                    .setTextColor(R.id.item_tv_operateType, ColorUtils.getColor(R.color.app_3DDCFF))
            }
            "Reject", "Return" -> {
                holder.setImageResource(R.id.view_cir, R.drawable.app_cir_ff3d3d)
                    .setTextColor(R.id.item_tv_operateType, ColorUtils.getColor(R.color.app_FF3D3D))
            }
            "Dispatch" -> {
                holder.setImageResource(R.id.view_cir, R.drawable.app_cir_ffb13d)
                    .setTextColor(R.id.item_tv_operateType, ColorUtils.getColor(R.color.app_FFB13D))
            }

            "OrderTaking" -> {
                holder.setImageResource(R.id.view_cir, R.drawable.app_cir_0a92fa)
                    .setTextColor(R.id.item_tv_operateType, ColorUtils.getColor(R.color.app_0A92FA))
            }

            "Finish" -> {
                holder.setImageResource(R.id.view_cir, R.drawable.app_cir_4cd964)
                    .setTextColor(R.id.item_tv_operateType, ColorUtils.getColor(R.color.app_4CD964))
            }
        }
    }
}